<?php

namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Session;
class Moonlighted extends Controller{
    /****
     * Class register                校园招聘添加
     * @$post['post_id']             招聘岗位id
     * @$post['salary']              薪资
     * @$post['name']                发布人姓名
     * @$post['sex']                 招聘性别:0=女，1=男，2=不限制
     * @$post['companytime']         工作时间
     * @$post['place']               工作地点
     * @$post['education']           学历:0=高中，1=中专，2=大专，3=本科，4=研究生
     * @$post['request']             需求
     * @$post['headline_id']         校园头条id                   
     * @date                            2020/06/2 
     * @package application\index\controller\Moonlighted
    */
    public function moonlighted(){
        $post = input('post.');
        $data=[
			'post_id'       =>$post['post_id'],
            'user_id'       =>$post['user_id'],
            'salary'        =>$post['salary'] ,
            'name'          =>$post['name'],
            'sex'           =>$post['sex'],
            'companytime'   =>$post['companytime'],
            'place'         =>$post['place'],
            'education'     =>$post['education'],
            'request'       =>$post['request'],
			'company'       =>$post['company'],
			'desc'       	=>$post['desc'],
            'headline_id'   =>$post['headline_id'],
			'describe'		=>$post['describe'],
			'years_of_working' =>$post['years_of_working'],
			'addtime'		=>time()
        ];  
        $headline_moonlighted = Db::name('headline_moonlighted')->insert($data);
        if($headline_moonlighted){
            $arr = [
               'state'     => 1,
               'message'  => "请求成功"
            ];
        }else{
            $arr = [
               'state'     => 0,
               'message'  => "请求失败！"
            ];
        }
        return json($arr);
    }
}
